﻿using System;
using System.Collections.Generic;
using System.Data;
using Microsoft.Reporting.WebForms;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;

namespace IMIS_ERP.Web.Head_Factory
{
    public partial class Report_Agent_MachineFee : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Pub_Useful.CheckRight.checkRight("ag_0|ag_1");
                Data_Bind("2110-1-1");
            }
        }

        private void Data_Bind(string strTime)
        {
            IMIS_ERP.BLL.Head_Factory bll = new BLL.Head_Factory();
            DataSet ds = bll.GetRpt(Session["aiProvince"].ToString(), "in(" + IMIS_ERP.BLL.Assistant.StrToQuotation(Session["aiArea"].ToString()) + ")", strTime);
            ReportDataSource rds = new ReportDataSource("ds", ds.Tables[0]);
            this.RV.LocalReport.DataSources.Clear();
            this.RV.LocalReport.DataSources.Add(rds);
            this.RV.DataBind();
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            string time = "2110-1-1";
            if (txthTime.Text != "")
            {
                time = txthTime.Text.Trim() + " 23:59:59";
            }
            Data_Bind(time);
        }
    }
}